﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.HomeServer.SDK.Interop.v1;
using Umbrella.Whs.Contracts;

public static class IUserInfoExtensionMethods
{
    public static UserInfo ToContract(this IUserInfo ui)
    {
        if (ui == null)
            throw new NullReferenceException("this is null");

        return new UserInfo()
        {
            Login = ui.LogOnName,
            FirstName = ui.FirstName,
            LastName = ui.LastName,
            IsGuestUser = ui.IsGuestUser(),
            FullName = ui.GetFullName(),
            Enabled = ((ui.Enabled != 0) && (ui.RemoteAllowed != 0)),
        };
    }
}
